/**
 * Created by meiguizhinian on 2018/7/9
 * Copyright © 2018 lixiaolong. All rights reserved.
 */

(function () {
	jssupport.RectArray = function (param) {
		//成员变量
		this.array = [];
	};
	let p = jssupport.RectArray.prototype;
	////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
	p.empty = function () {
		return this.array.length === 0;
	};
	p.clear = function () {
		if (!this.empty()) {
			this.array = [];
		}
	};
	p.find = function (name) {
		for (let i=0; i!==this.array.length; ++i) {
			let rect = this.array[i];
			if (rect.name && rect.name===name) {
				return rect;
			}
		}
		return null;
	};

	p.intersects = function (rect) {
		for (let i=0; i!==this.array.length; ++i) {
			let r = this.array[i];
			if (jssupport.rectIntersectsRect(r, rect)) {
				return true;
			}
		}
		return false;
	};
	p.contains = function (rect) {
		for (let i=0; i!==this.array.length; ++i) {
			let r = this.array[i];
			if (jssupport.rectContainsRect(r,rect)) {
				return true;
			}
		}
		return false;
	};
})();
